/*
 * @Author: chen haoxuan
 * @Date: 2021-05-18 21:53:59
 * @LastEditTime: 2021-05-18 22:05:31
 */
#include<iostream>
using namespace std;
class Complex
{
    public:
        Complex(double real = 0,double iamg =0);
        Complex Complex_add(Complex &a);
        void display();
    private:
        double real;
        double imag;
};
Complex::Complex(double r, double i)
{
    real=r;
    imag=i;
}
Complex Complex::Complex_add(Complex &a)
{
    Complex c;
    c.real=real+a.real;
    c.imag=imag+a.imag;
    return c;
}
void Complex::display()
{
    cout<<"("<<real<<","<<imag<<"i)"<<endl;
}
int main()
{
    Complex a(1,2),b(2,-4),c;
    c=a.Complex_add(b);
    a.display();
    b.display();
    c.display();
    system("pause");
}